package mysql

import "gorm.io/gorm"

type UserZye6 struct {
	gorm.Model
	Username string `gorm:"type:varchar(20);unique;comment:账户;"`
	Password string `gorm:"type:char(32);unique;comment:密码;"`
	Mobile   string `gorm:"type:char(11);unique;comment:手机号;"`
}

type HouseZye6 struct {
	gorm.Model
	name    string `gorm:"type:varchar(20);unique;comment:名称;"`
	Address string `gorm:"type:varchar(30);unique;comment:地址;"`
}

type PositionZye6 struct {
	gorm.Model
	PositionName   string  `gorm:"type:varchar(30);unique;comment:职位名称;"`
	PositionLeiBie string  `gorm:"type:char(10);unique;comment:职位类别;"`
	Address        string  `gorm:"type:varchar(30);unique;comment:地址;"`
	Price          float64 `gorm:"type:decimal(10,2);unique;comment:价格;"`
	Work           string  `gorm:"type:varchar(20);unique;comment:工作;"`
}

// 注册
func (u *UserZye6) RegisterByMobile(mobile string) error {
	return DB.Create(&u).Error
}

// 查询
func (u *UserZye6) FindByMobile(mobile string) error {
	return DB.Where("mobile = ?", mobile).Find(&u).Error
}

// 发布
func (u *HouseZye6) Create() error {
	return DB.Create(&u).Error
}
